﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class User_CTIReg_CTIEnter : System.Web.UI.Page
{
    UserBean bllUser = new UserBean();
    WebUtility bllUtility = new WebUtility();

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btn_Submit_Click(object sender, ImageClickEventArgs e)
    {
        string userType = Request.QueryString["UserType"].ToString();
        string regType = Request.QueryString["RegType"].ToString();

        string mobileNO = WebUtility.replaceStr(this.userName.Text.Trim());
        string userPwd = WebUtility.replaceStr(this.password.Text.Trim());

        DataTable dtUserInfo = bllUser.GetRegUserInfo(mobileNO, userPwd);
        if (dtUserInfo.Rows.Count <= 0)
        {
            bllUtility.AlertMsg("用户名或密码错误，请重新输入！");
            return;
        }
        else if (dtUserInfo.Rows[0]["U_UserType"].ToString().Trim() != "2")
        {
            bllUtility.AlertMsg("用户类型必须为CTI用户！");
            return;
        }
        else
        {
            if (userType == "0" && regType == "2")
            {
                Response.Redirect("CTIPersonal.aspx?AccountNO=" + mobileNO + "");
            }
            else
            {
                Response.Redirect("CTICompany.aspx?AccountNO=" + mobileNO + "");
            }
        }

    }
}
